<template>
  <div>
    <el-table :data="processPlanList" stripe border class="user-table" style="width: 100%;" :cell-class-name="cellClassName" :header-cell-class-name="cellClassName"> 
      <el-table-column fixed type="index" label="*" sortable min-width="30" align="center"></el-table-column>
      <el-table-column prop="no" label="工序号" sortable  min-width="30" align="center"></el-table-column>
      <el-table-column prop="nameName" label="工序名称" sortable min-width="80" align="center">
        <template slot-scope="scope">
          <div class="content-rowspan">
            <div>{{scope.row.nameName}}</div>
            <div>首检</div>
            <div>次检</div>
          </div>
        </template>
      </el-table-column>
      <el-table-column  label="工序内容" sortable min-width="180" align="center">
        <template slot-scope="scope">
          <div class="content-rowspan">
            <div :title="scope.row.content" class="overflow-ellipsis" v-html="scope.row.content"></div>
            <div :title="scope.row.checkContent" class="overflow-ellipsis" v-html="scope.row.checkContent"></div>
            <div :title="scope.row.cjCheckContent" class="overflow-ellipsis" v-html="scope.row.cjCheckContent"></div>
          </div>
        </template>
      </el-table-column>
      <el-table-column  label="工时" min-width="160" align="center">
        <el-table-column  label="估工" sortable width="80" align="center">
          <template slot-scope="scope">
            <div class="content-rowspan">
              <div>{{scope.row.predictWorkTime}}</div>
              <div>{{scope.row.checkPredictWorkTime}}</div>
              <div>{{scope.row.cjCheckPredictWorkTime}}</div>
            </div>
          </template>
        </el-table-column>
        <el-table-column label="固定" sortable width="80" align="center">
          <template slot-scope="scope">
            <div class="content-rowspan">
              <div>{{scope.row.confirmWorkTime}}</div>
              <div>{{scope.row.checkConfirmWorkTime}}</div>
              <div>{{scope.row.cjCheckConfirmWorkTime}}</div>
            </div>
          </template>
        </el-table-column>
      </el-table-column>
       <el-table-column prop="wbPrice1" label="总工时" sortable width="80" align="center">
       </el-table-column>
      <el-table-column prop="creatorName" label="创建人" sortable width="100"></el-table-column>
      <el-table-column prop="createTime" label="创建时间" sortable width="110" :formatter="timeFormatter"></el-table-column>
      <el-table-column fixed="right" label="操作" align="center" min-width="80">
        <template slot-scope="scope">
          <slot  :row="scope.row"></slot>
        </template>
      </el-table-column>
    </el-table>
  </div>
</template>
<script>
import materielApi from 'plugins/axios/materielApi.js';
import baseApi from 'plugins/axios/baseApi.js';
export default {
  name: 'processPlanDetail',
  props:{
    isApiType:{
      type:Number,
      default:1
    },
    drawCode:{
      type:String
    },
    formData:{
      type:Object
    }
  },
  data (){
    return {
      processPlanList:[]
    }
  },
  watch:{
 
  },
  created(){

  },
  methods:{
     /**时间格式化 */
    timeFormatter(row, column, cellValue, index){
      return cellValue?this.timestampToTime(cellValue,'yyyy-mm-dd'):'';
    },
    cellClassName({row, column, rowIndex, columnIndex}){
      if(columnIndex>0&&columnIndex<6){
        return 'nopadding'
      }
    },
     /**获取工艺编制列表 */
    getProcessPlanList(){
      let self = this;
      if(self.isApiType===1){
        materielApi.processPlanList1({
        drawNo:self.drawCode
        }).then(res=>{
          res.content.forEach(item=>{
           item.wbPrice1 = Number(item.wbPrice+(item.predictWorkTimeTotal*self.formData.nums)).toFixed(2)
          })
          self.processPlanList=res.content;
        })
      }else{
        materielApi.processPlanList2(self.formData.id).then(res=>{
          res.content.forEach(item=>{
           item.wbPrice1 = (item.wbPrice+(item.predictWorkTimeTotal*self.formData.nums))
          })
          self.processPlanList=res.content;
        })
      }
      
      
    },
  }
}
</script>
<style lang="stylus" scoped>
.content-rowspan div
    padding-left 13px
    line-height 46px
    height 46px
    border-bottom 1px solid #ECEDEE
    &:last-child
      border-bottom:none
</style>